const {
  apiRootPath,
  developmentUrl,
  mockUrl
} = require("./src/configurations.js");
const path = require("path").posix;
const devPath = path.join(apiRootPath, "development");
const devPathReplacement = `^${devPath}`;
const mockPath = path.join(apiRootPath, "mock");
const mockPathReplacement = `^${mockPath}`;

const proxy = {};
proxy[devPath] = {
  target: developmentUrl,
  changeOrigin: true,
  ws: true,
  pathRewrite: {}
};
proxy[devPath].pathRewrite[devPathReplacement] = "";

proxy[mockPath] = {
  target: mockUrl,
  changeOrigin: true,
  ws: true,
  pathRewrite: {}
};
proxy[mockPath].pathRewrite[mockPathReplacement] = "";
proxy["/outerApi"] = {
  target: "http://192.168.8.166:8099",
  changeOrigin: true,
  ws: true,
  pathRewrite: { "^/outerApi": "" }
};

proxy["/apiP4"] = {
  //   target: "https://gzbbn.cn-elite.com:1443/api/p4",
  target: "https://gzbbn.cn-elite.com:1443/api/p4ex",
  changeOrigin: true,
  ws: true,
  pathRewrite: { "^/apiP4": "" }
};
console.log(proxy);

module.exports = proxy;
